// 应用管理相关接口
import axios from '../interceptors.js'

// 获取应用列表
export const getList = (data) => {
  return axios({
    url: '/app/list?sort=createdDate,desc',
    method: 'get',
    params: data
  })
}

// 删除应用
export const delApplication = (data) => {
  return axios({
    url: '/app/del/' + data,
    method: 'delete'
  })
}

// 新建应用
export const createApp = (data) => {
  return axios({
    url: '/app/create',
    method: 'post',
    data
  })
}

// 编辑应用
export const editApp = (data) => {
  return axios({
    url: '/app/update/' + data.id,
    method: 'put',
    data
  })
}

// 应用版本列表
export const getAppVersion = (data) => {
  return axios({
    url: '/app-version/list/' + data.id + '?sort=createdDate,desc',
    method: 'get',
    params: data
  })
}

// 获取应用版本日志列表
export const getBuildLogList = (data) => {
  return axios({
    url: '/app-version/builds/' + data.appId + '/' + data.buildNumber,
    method: 'get'
  })
}

// 获取应用版本日志详情
export const getBuildLogdetail = (data) => {
  return axios({
    url: '/app-version/logs/' + data.appId + '/' + data.buildNumber + '/' + data.pid,
    method: 'get'
  })
}
